function scan(){

    wx.scanQRCode({
        needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
        scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
        success: function (res) {
            var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
            var url = result+"?token="+localStorage.token;
            wfHttp.post(url,undefined,{succ: scanSuccess,fail:scanFail})
        }
    });
}
var scanSuccess = function(resp){
    if(resp.code == 0){
        alert("恭喜您,操作成功");
        $('#point').text(resp.message);
    }else{
        alert(resp.message);
    }
};
var scanFail = function(resp){
    alert(resp.message);
};

$(document).ready(function(){
    wfHttp.get("/users/member/info?token="+localStorage.token,
        {succ: function(resp){
            console.log(resp);
            $('#nickname').text('hi,'+resp.message.nickname);
            $('#point').text(resp.message.memberPoint);
            if(resp.message.portrait == null ||resp.message.portrait == undefined || resp.message.portrait == 'null'){
                console.log('portrait null');
            }else{
                $('#avatar').attr('src',resp.message.portrait);
            }
        },fail:scanFail});
});

